<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('推广短信列表')"/>
</head>

<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <input type="hidden" name="memberIdStr" id="memberIdStr" th:value="${memberIdStr}">
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: jasny-bootstrap-js"/>
<script th:inline="javascript">
    const productTypeDict = [[${@dict.getType('product_type')}]];
    const prefix = ctx + "back/lianLuSms";
    $(function () {
        var options = {
            url: prefix + "/searchTemplateList",
            modalName: "阿里云短信模板",
            paginationShowPageGo: true,
            clickToSelect: true,
            columns: [
                {
                    field: 'templateName',
                    title: '模板名称',
                },
                {
                    field: 'templateCode',
                    title: '模板标识',
                    visible: false
                },
                {
                    field: 'templateContent',
                    title: '短信内容',
                },
                {
                    field: 'createDate',
                    title: '创建时间',
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-primary btn-xs" href="#" onclick="send(\'' + row.templateCode + '\',true)"><i class="fa fa-send">发送</i></a> ');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });

    function queryParams(params) {
        var search = $.table.queryParams(params);
        search.memberIdStr = $('#memberIdStr').val();
        return search;
    }

    /* 发送短信-提交 */
    function send(templateCode) {
        var data = {"memberIdStr": $('#memberIdStr').val(), "templateCode": templateCode};
        $.operate.save(prefix + "/send", data);
    }
</script>
</body>
</html>